home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 19 / CU Amiga Magazine's Super CD-ROM 19 (1998)(EMAP Images)(GB)[!][issue 1998-02].iso / CUCD / Programming / LEDA / source / src / vga / vga.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-16  |  3.1 KB  |  146 lines

  1. /*******************************************************************************
  2. +
  3. +  LEDA  3.1c
  4. +
  5. +
  6. +  vga.h
  7. +
  8. +
  9. +  Copyright (c) 1994  by  Max-Planck-Institut fuer Informatik
  10. +  Im Stadtwald, 6600 Saarbruecken, FRG     
  11. +  All rights reserved.
  12. *******************************************************************************/
  13.  
  14.  
  15. #include <LEDA/impl/x_basic.h>
  16. #include <LEDA/bitmaps/leda_icon.xbm>
  17.  
  18. #include <stdlib.h>
  19. #include <string.h>
  20. #include <math.h>
  21.  
  22.  
  23. #if defined(__MSDOS__) || defined(__ZTC__)
  24.  
  25. #if defined(__TURBOC__)
  26. struct WORDREGS { unsigned int    ax, bx, cx, dx, si, di, cflag, flags; };
  27. struct BYTEREGS { unsigned char   al, ah, bl, bh, cl, ch, dl, dh; };
  28. union  REGS { struct  WORDREGS x; struct  BYTEREGS h; };
  29. extern "C" int  int86( int __intno, union REGS _FAR *, union REGS _FAR *);
  30. extern "C" unsigned char inportb(int port_id);
  31. extern "C" void outportb(int portid, unsigned char value);
  32. extern "C" int getch( void );
  33. extern "C" int kbhit( void );
  34. #define MK_FP( seg,ofs )( (void _seg * )( seg ) +( void near * )( ofs ))
  35. #else
  36. #include <dos.h>
  37. #if defined(__GNUG__)
  38. #include <pc.h>
  39. #else
  40. #include <conio.h>
  41. #endif
  42. #endif
  43.  
  44. #if defined(__GNUG__)
  45. #define port_out(value,port) outportb(port,value)
  46. #define port_in(port)  inportb(port)
  47. #else
  48. #if defined(__TURBOC__)
  49. #define port_out(value,port) outportb(port,value)
  50. #define port_in(port)  inportb(port)
  51. #else
  52. #define port_out(value,port) outp(port,value)
  53. #define port_in(port)  inp(port)
  54. #endif
  55.  
  56. #endif
  57.  
  58. #else
  59. // LINUX
  60. struct WORDREGS { unsigned int    ax, bx, cx, dx, si, di, cflag, flags; };
  61. struct BYTEREGS { unsigned char   al, ah, bl, bh, cl, ch, dl, dh; };
  62. union  REGS { struct  WORDREGS x; struct  BYTEREGS h; };
  63.  
  64. inline int  int86(int, REGS*, REGS*) {}
  65.  
  66. static inline void port_out( int value, int port )
  67. {
  68.     __asm__ volatile ("outb %0,%1"
  69.     : : "a" ((unsigned char)value), "d" ((unsigned short)port));
  70. }
  71.  
  72. static inline void port_outw( int value, int port )
  73. {
  74.     __asm__ volatile("outw %0,%1"
  75.     : : "a" ((unsigned short)value), "d" ((unsigned short)port));
  76. }
  77.  
  78. static inline int port_in( int port )
  79. {
  80.     unsigned char value;
  81.     __asm__ volatile ("inb %1,%0"
  82.         : "=a" (value)
  83.         : "d" ((unsigned short)port));
  84.     return value;
  85. }
  86.  
  87. extern char getch();
  88.  
  89. #endif
  90.  
  91.  
  92. #define GRA_I 0x3CE
  93. #define GRA_D 0x3CF
  94.  
  95. #if defined (__ZTC__) || defined(__TURBOC__)
  96. typedef unsigned char far* VIDEO_PTR;
  97. #else
  98. typedef unsigned char* VIDEO_PTR;
  99. #endif
  100.  
  101. struct vga_window
  102. {
  103.  VIDEO_PTR plane[4];
  104.  int       width;
  105.  int       height;
  106.  int       xpos;
  107.  int       ypos;
  108.  int       x0;
  109.  int       y0;
  110.  int       x1;
  111.  int       y1;
  112.  int       bg_col;
  113.  int       label_col;
  114.  char      header[128];
  115.  char      label[128];
  116.  char      iconized;
  117.  int       save_xpos;
  118.  int       save_ypos;
  119.  int       save_x0;
  120.  int       save_y0;
  121.  int       save_x1;
  122.  int       save_y1;
  123.  int       save_bg_col;
  124.  int       id;
  125. };
  126.  
  127. typedef vga_window* VgaWindow;
  128.  
  129.  
  130. extern VIDEO_PTR  VIDEO;
  131. extern int DISP_WIDTH;
  132. extern int DISP_MAX_X;
  133. extern int LINE_BYTES;
  134.  
  135. extern int DISP_HEIGHT;
  136. extern int DISP_MAX_Y;
  137.  
  138. extern int DISP_DEPTH;
  139.  
  140. extern VgaWindow  win_stack[16];
  141. extern int win_top;
  142.  
  143. void vga_init(int mode, int root_col);
  144.  
  145.